import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WorkorderProcessVO, WorkorderProcessForm, WorkorderProcessQuery } from '@/api/workorder/workorderProcess/types';

/**
 * 查询工单流程日志列表
 * @param query
 * @returns {*}
 */

export const listWorkorderProcess = (query?: WorkorderProcessQuery): AxiosPromise<WorkorderProcessVO[]> => {
  return request({
    url: '/workorder/workorderProcess/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工单流程日志详细
 * @param id
 */
export const getWorkorderProcess = (id: string | number): AxiosPromise<WorkorderProcessVO> => {
  return request({
    url: '/workorder/workorderProcess/' + id,
    method: 'get'
  });
};

/**
 * 新增工单流程日志
 * @param data
 */
export const addWorkorderProcess = (data: WorkorderProcessForm) => {
  return request({
    url: '/workorder/workorderProcess',
    method: 'post',
    data: data
  });
};

/**
 * 修改工单流程日志
 * @param data
 */
export const updateWorkorderProcess = (data: WorkorderProcessForm) => {
  return request({
    url: '/workorder/workorderProcess',
    method: 'put',
    data: data
  });
};

/**
 * 删除工单流程日志
 * @param id
 */
export const delWorkorderProcess = (id: string | number | Array<string | number>) => {
  return request({
    url: '/workorder/workorderProcess/' + id,
    method: 'delete'
  });
};
